Skip to content

Conversation

@rfsaliev
Copy link
Member

No description provided.

};

// TODO:
// 1. Should StorageKind, metric, be a part of BuildParams?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StorageKind and metric should not be part of BuildParams. We use DataType and QueryType in SVS for storage kinds. If it's possible we can stick to those.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made StorageKind globally defined by moving svs::runtime namespace in IndexSVSImplDefs.h.

};

struct SearchParams {
size_t search_window_size = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the two prefetching parameters here. Even if those will be kept to default values in general, it'd be good to have them here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@rfsaliev rfsaliev marked this pull request as ready for review November 7, 2025 15:17
Copy link
Contributor

@ahuber21 ahuber21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments. Let's discuss how to tackle todos.

///
/// @brief Version information and API versioning for SVS Runtime
///
/// This header defines the SVS Runtime API versioning scheme similar to oneDAL:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference to oneDAL should be removed

* limitations under the License.
*/

#include <svs/runtime/dynamic_vamana_index.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to sort all headers in the order

  1. "Local" headers (includes with quotes, same directory)
  2. SVS runtime headers
  3. SVS core headers
  4. deps headers
  5. std library, other core headers

Also, in svs/include we use mainly quote includes. IMO we should stay consistent here. Or are there reasons against?

IDFilter* filter = nullptr
) const noexcept override {
return runtime_error_wrapper([&] {
// TODO wrap arguments into proper data structures in DynamicVamanaIndexImpl and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve todo

IDFilter* filter = nullptr
) const noexcept override {
return runtime_error_wrapper([&] {
// TODO wrap arguments into proper data structures in DynamicVamanaIndexImpl and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve todo

if (filter == nullptr) {
auto queries = svs::data::ConstSimpleDataView<float>(x, n, dim_);

// TODO: faiss use int64_t as label whereas SVS uses size_t?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be possible to remove this, because conversion is now handled at library boundary?

Comment on lines +148 to +150
for (; found < k; ++found) {
curr_distances[found] = -1;
curr_labels[found] = -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is padding with -1 specific to Faiss? Would it make sense to accept a parameter to pick a different value for padding? Maybe even skip this entirely?

Status search(size_t n, const float* x, size_t k, float* distances, size_t* labels)
const noexcept override {
return runtime_error_wrapper([&] {
// TODO wrap arguments into proper data structures in FlatIndexImpl and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve todo

if (filter == nullptr) {
auto queries = svs::data::ConstSimpleDataView<float>(x, n, dim_);

// TODO: faiss use int64_t as label whereas SVS uses size_t?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve todo, same comment about type as above

auto matrix = svs::leanvec::compute_leanvec_matrix<svs::Dynamic, svs::Dynamic>(
data, means, threadpool, svs::lib::MaybeStatic<svs::Dynamic>{leanvec_dims}
);
// Create a copy of the matrix for the query matrix to avoid double free.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my understanding: Explicit copy with 2x move gives 1 copy, passing twice by value 2 copies. So in interest of performance, we do it like this?

So, it should be equivalent to LeanVecMatricesType{std::move(matrix), matrix}; ?

/bindings/python/dist/

# CPP bindings build files
/bindings/cpp/build/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/bindings/cpp/build/
build
build_*

More generic?

return make_storage<StorageType_t<Tag>>(std::forward<Args>(args)...);
}

inline StorageKind to_supported_storage_kind(StorageKind kind) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we planning to make the behavior configurable? What if the user wants to throw an error instead. I don't know if a silent fallback is good behavior of the runtime...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants